# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-csv23
pkgver=0.3.4
pkgrel=2
pkgdesc="Python 3 unicode CSV compatibility layer"
url="https://github.com/xflr6/csv23"
license=('MIT')
arch=('any')
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-pytest' 'python-mock' 'python-pytest-mock')
source=("https://github.com/xflr6/csv23/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('ff7fc4a488316fb19501549bb6db56aee830348cddedca99bc8d452f85b787907f4831a5b4371375d45f9ada47b23fc33e8105177431b576fd228d8fce81354d')

prepare() {
  cd csv23-$pkgver
  sed -i '/--cov/d' setup.cfg
}

build() {
  cd csv23-$pkgver
  python setup.py build
}

check() {
  cd csv23-$pkgver
  python -m pytest
}

package() {
  cd csv23-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
}
